package com.playball.lottery.customview;

import java.util.ArrayList;
import java.util.HashMap;

import android.content.Context;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.Button;
import android.widget.ImageButton;
import android.widget.TextView;
import android.widget.Toast;

import com.playball.lottery.R;
import com.playball.lottery.frm.buyhall.BDxhlbActivity;
import com.playball.lottery.frm.buyhall.CQSSCListActivity;
import com.playball.lottery.frm.buyhall.DltxhlbActivity;
import com.playball.lottery.frm.buyhall.ElvSelFiveListActivity;
import com.playball.lottery.frm.buyhall.ElvYunDJListActivity;
import com.playball.lottery.frm.buyhall.Fc3dListActivity;
import com.playball.lottery.frm.buyhall.JcBasketballxhlbActivity;
import com.playball.lottery.frm.buyhall.JcfootxhlbActivity;
import com.playball.lottery.frm.buyhall.Kuai3ListActivity;
import com.playball.lottery.frm.buyhall.N7lxhlbActivity;
import com.playball.lottery.frm.buyhall.N7xxhlbActivity;
import com.playball.lottery.frm.buyhall.Pailie3ListActivity;
import com.playball.lottery.frm.buyhall.Pailie5ListActivity;
import com.playball.lottery.frm.buyhall.SsqxhlbActivity;
import com.playball.lottery.util.JCUtil;



public class DelButtonAdapter extends BaseAdapter {

	private class MyViewHolder {
		TextView Ball_red;
		TextView Ball_blue;
		TextView Ball_money;
		ImageButton buttonClose;
	}

	private class MyElvSelFive {
		TextView ball;
		TextView ball_money;
		Button buttonClose;
	}

	private class MyJcFoot {
		TextView hteam;
		TextView vteam;
		Button sbut;
		Button pbut;
		Button fbut;
		Button buttonClose;
		TextView vs;
	}

	private ArrayList<HashMap<String, Object>> mAppList;
	private LayoutInflater mInflater;
	private Context mContext;
	private String[] keyString;
	private int[] valueViewID;
	private MyViewHolder myholder;
	private MyElvSelFive myElv;
	private MyJcFoot myFoot;

	private String str_hteam;
	private String str_vteam;
	private String str_sp;
	private String str_eq;

	public DelButtonAdapter(ArrayList<HashMap<String, Object>> appList) {
		mAppList = appList;
	}

	public DelButtonAdapter(Context c, ArrayList<HashMap<String, Object>> appList, int resource, String[] from, int[] to) {
		mAppList = appList;
		mContext = c;
		mInflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
		keyString = new String[from.length];
		valueViewID = new int[to.length];
		System.arraycopy(from, 0, keyString, 0, from.length);
		System.arraycopy(to, 0, valueViewID, 0, to.length);
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		// 双色球
		/*if (mContext.getClass().equals(SsqxhlbActivity.class)) {
			if (convertView != null) {
				myholder = (MyViewHolder) convertView.getTag();
			} else {
				convertView = mInflater.inflate(R.layout.buy_ssqxhlb_list, null);
				myholder = new MyViewHolder();
				myholder.Ball_red = (TextView) convertView.findViewById(valueViewID[0]);
				myholder.Ball_blue = (TextView) convertView.findViewById(valueViewID[1]);
				myholder.Ball_money = (TextView) convertView.findViewById(valueViewID[2]);
				myholder.buttonClose = (ImageButton) convertView.findViewById(valueViewID[3]);
				convertView.setTag(myholder);
			}

			HashMap<String, Object> appInfo = mAppList.get(position);
			if (appInfo != null) {
				String ball1 = (String) appInfo.get(keyString[0]);
				String ball2 = (String) appInfo.get(keyString[1]);
				String ball3 = (String) appInfo.get(keyString[2]);
				int bid = (Integer) appInfo.get(keyString[3]);
				myholder.Ball_red.setText(ball1);
				myholder.Ball_blue.setText(ball2);
				myholder.Ball_money.setText(ball3);
				// myholder.buttonClose.setImageDrawable(myholder.buttonClose.getResources().getDrawable(bid));
				myholder.buttonClose.setOnClickListener(new lvButtonListener(position, myholder.buttonClose.getId()));
			}
			// 大乐透
		} else if (mContext.getClass().equals(DltxhlbActivity.class)) {
			if (convertView != null) {
				myholder = (MyViewHolder) convertView.getTag();
			} else {
				convertView = mInflater.inflate(R.layout.buy_dltxhlb_list, null);
				myholder = new MyViewHolder();
				myholder.Ball_red = (TextView) convertView.findViewById(valueViewID[0]);
				myholder.Ball_blue = (TextView) convertView.findViewById(valueViewID[1]);
				myholder.Ball_money = (TextView) convertView.findViewById(valueViewID[2]);
				myholder.buttonClose = (ImageButton) convertView.findViewById(valueViewID[3]);
				convertView.setTag(myholder);
			}

			HashMap<String, Object> appInfo = mAppList.get(position);
			if (appInfo != null) {
				String ball1 = (String) appInfo.get(keyString[0]);
				String ball2 = (String) appInfo.get(keyString[1]);
				String ball3 = (String) appInfo.get(keyString[2]);
				int bid = (Integer) appInfo.get(keyString[3]);
				myholder.Ball_red.setText(ball1);
				myholder.Ball_blue.setText(ball2);
				myholder.Ball_money.setText(ball3);
				// myholder.buttonClose.setImageDrawable(myholder.buttonClose.getResources().getDrawable(bid));
				myholder.buttonClose.setOnClickListener(new lvButtonListener(position, myholder.buttonClose.getId()));
			}
			// 11选5  11运夺金 排列3 排列5 福彩3D 22选5
		} else if (mContext.getClass().equals(ElvSelFiveListActivity.class) || mContext.getClass().equals(ElvYunDJListActivity.class)|| mContext.getClass().equals(CQSSCListActivity.class)
				|| mContext.getClass().equals(Pailie3ListActivity.class) || mContext.getClass().equals(Pailie5ListActivity.class)
				|| mContext.getClass().equals(Fc3dListActivity.class) || mContext.getClass().equals(N7xxhlbActivity.class)
				|| mContext.getClass().equals(N7lxhlbActivity.class)|| mContext.getClass().equals(Kuai3ListActivity.class)) {
			if (convertView != null) {
				myElv = (MyElvSelFive) convertView.getTag();
			} else {
				convertView = mInflater.inflate(R.layout.buy_11x5_listnum, null);
				myElv = new MyElvSelFive();
				myElv.ball = (TextView) convertView.findViewById(valueViewID[0]);
				myElv.ball_money = (TextView) convertView.findViewById(valueViewID[1]);
				myElv.buttonClose = (Button) convertView.findViewById(valueViewID[2]);
				convertView.setTag(myElv);
			}

			HashMap<String, Object> appInfo = mAppList.get(position);
			if (appInfo != null) {
				String ball = (String) appInfo.get(keyString[0]);
				String money = (String) appInfo.get(keyString[1]);
				int bid = (Integer) appInfo.get(keyString[2]);
				myElv.ball.setText(ball);
				myElv.ball_money.setText(money);
				// myElv.buttonClose.setBackgroundDrawable(myElv.buttonClose.getResources().getDrawable(bid));
				myElv.buttonClose.setOnClickListener(new lvButtonListener(position, myElv.buttonClose.getId()));
			}
			// 竞彩足球
		} else */if (mContext.getClass().equals(JcfootxhlbActivity.class)) {
			if (convertView != null) {
				myFoot = (MyJcFoot) convertView.getTag();
			} else {
				convertView = mInflater.inflate(R.layout.jczq_spf_xhlb_item, null);
				myFoot = new MyJcFoot();
				myFoot.hteam = (TextView) convertView.findViewById(valueViewID[0]);
				myFoot.vteam = (TextView) convertView.findViewById(valueViewID[1]);
				myFoot.sbut = (Button) convertView.findViewById(valueViewID[2]);
				myFoot.pbut = (Button) convertView.findViewById(valueViewID[3]);
				myFoot.fbut = (Button) convertView.findViewById(valueViewID[4]);
				myFoot.buttonClose = (Button) convertView.findViewById(valueViewID[5]);
				myFoot.vs = (TextView) convertView.findViewById(valueViewID[6]);
				convertView.setTag(myFoot);
			}

			try {
				myFoot.sbut.setSelected(false);
				myFoot.pbut.setSelected(false);
				myFoot.fbut.setSelected(false);
				HashMap<String, Object> appInfo = mAppList.get(position);
				if (appInfo != null) {
					str_hteam = (String) appInfo.get(keyString[1]);
					str_vteam = (String) appInfo.get(keyString[2]);
					str_sp = (String) appInfo.get(keyString[3]);
//					int bid = (Integer) appInfo.get(keyString[4]);
					myFoot.hteam.setText(str_hteam);
					myFoot.vteam.setText(str_vteam);
					str_sp=JCUtil.zhuanHuanSPGeShi(str_sp);
					if (containsAny(str_sp, "3")) {
						myFoot.sbut.setSelected(true);
					}
					if (containsAny(str_sp, "1")) {
						myFoot.pbut.setSelected(true);
					}
					if (containsAny(str_sp, "0")) {
						myFoot.fbut.setSelected(true);
					}
					
					str_eq = (String) appInfo.get(keyString[5]);
					myFoot.vs.setText(str_eq);
					
					// myFoot.buttonClose.setBackgroundDrawable(myFoot.buttonClose.getResources().getDrawable(bid));
					myFoot.buttonClose.setOnClickListener(new jcButtonListener(position, myFoot.buttonClose.getId(), "JcfootxhlbActivity"));
				}
			} catch (Exception e) {
				// TODO: handle exception
//				e.printStackTrace();
			}
		} //北单
		else if (mContext.getClass().equals(BDxhlbActivity.class)) {
			if (convertView != null) {
				myFoot = (MyJcFoot) convertView.getTag();
			} else {
				convertView = mInflater.inflate(R.layout.buy_jcxhlb_list, null);
				myFoot = new MyJcFoot();
				myFoot.hteam = (TextView) convertView.findViewById(valueViewID[0]);
				myFoot.vteam = (TextView) convertView.findViewById(valueViewID[1]);
				myFoot.sbut = (Button) convertView.findViewById(valueViewID[2]);
				myFoot.pbut = (Button) convertView.findViewById(valueViewID[3]);
				myFoot.fbut = (Button) convertView.findViewById(valueViewID[4]);
				myFoot.buttonClose = (Button) convertView.findViewById(valueViewID[5]);
				myFoot.vs = (TextView) convertView.findViewById(valueViewID[6]);
				convertView.setTag(myFoot);
			}

			try {
				myFoot.sbut.setSelected(false);
				myFoot.pbut.setSelected(false);
				myFoot.fbut.setSelected(false);
				HashMap<String, Object> appInfo = mAppList.get(position);
				if (appInfo != null) {
					str_hteam = (String) appInfo.get(keyString[1]);
					str_vteam = (String) appInfo.get(keyString[2]);
					str_sp = (String) appInfo.get(keyString[3]);
					int bid = (Integer) appInfo.get(keyString[4]);
					myFoot.hteam.setText(str_hteam);
					myFoot.vteam.setText(str_vteam);
//					System.out.println(str_hteam + "VS" + str_vteam + "----" + str_sp);
					str_sp=JCUtil.zhuanHuanSPGeShi(str_sp);
					if (containsAny(str_sp, "3")) {
						myFoot.sbut.setSelected(true);
					}
					if (containsAny(str_sp, "1")) {
						myFoot.pbut.setSelected(true);
					}
					if (containsAny(str_sp, "0")) {
						myFoot.fbut.setSelected(true);
					}
					
					str_eq = (String) appInfo.get(keyString[5]);
					myFoot.vs.setText(str_eq);
					
					// myFoot.buttonClose.setBackgroundDrawable(myFoot.buttonClose.getResources().getDrawable(bid));
					myFoot.buttonClose.setOnClickListener(new jcButtonListener(position, myFoot.buttonClose.getId(), "BDxhlbActivity"));
				}
			} catch (Exception e) {
				// TODO: handle exception
//				System.out.println(e.toString());
			}
		} else if (mContext.getClass().equals(JcBasketballxhlbActivity.class)) {  //竞彩篮球
			if (convertView != null) {
				myFoot = (MyJcFoot) convertView.getTag();
			} else {
				convertView = mInflater.inflate(R.layout.jdd_jclq_xhlb_item, null);
				myFoot = new MyJcFoot();
				myFoot.hteam = (TextView) convertView.findViewById(valueViewID[0]);
				myFoot.vteam = (TextView) convertView.findViewById(valueViewID[1]);
				myFoot.sbut = (Button) convertView.findViewById(valueViewID[2]);
//				myFoot.pbut = (Button) convertView.findViewById(valueViewID[3]);
//				myFoot.pbut.setVisibility(View.INVISIBLE);
				myFoot.fbut = (Button) convertView.findViewById(valueViewID[4]);
				myFoot.buttonClose = (Button) convertView.findViewById(valueViewID[5]);
				convertView.setTag(myFoot);
			}

			try {
				myFoot.sbut.setSelected(false);
//				myFoot.pbut.setSelected(false);
				myFoot.fbut.setSelected(false);
				HashMap<String, Object> appInfo = mAppList.get(position);
				if (appInfo != null) {
					str_hteam = (String) appInfo.get(keyString[1]);
					str_vteam = (String) appInfo.get(keyString[2]);
					str_sp = (String) appInfo.get(keyString[3]);
					int bid = (Integer) appInfo.get(keyString[4]);
					String strLQWF = (String) appInfo.get(keyString[5]);
					myFoot.hteam.setText(str_hteam);
					myFoot.vteam.setText(str_vteam);

					if (strLQWF.equals("RFSF")) {
						myFoot.sbut.setText("主负");
						myFoot.fbut.setText("主胜");
					} else if (strLQWF.equals("SF")) {
						myFoot.sbut.setText("主负");
						myFoot.fbut.setText("主胜");
					} else if (strLQWF.equals("DXF")) {
						myFoot.sbut.setText("大分");
						myFoot.fbut.setText("小分");
					}
					str_sp=JCUtil.zhuanHuanSPGeShi(str_sp);
					if (containsAny(str_sp, "3")) {
						myFoot.fbut.setSelected(true);
					}
					if (containsAny(str_sp, "1")) {
						myFoot.pbut.setSelected(true);
					}
					if (containsAny(str_sp, "0")) {
						myFoot.sbut.setSelected(true);
					}
					myFoot.buttonClose.setOnClickListener(new jcButtonListener(position, myFoot.buttonClose.getId(),"JcBasketballxhlbActivity"));
				}
			} catch (Exception e) {
				// TODO: handle exception
//				e.printStackTrace();
			}
			// 胜负彩
		} /*else if (mContext.getClass().equals(ZqsfcxhlbActivity.class)) {
			if (convertView != null) {
				myFoot = (MyJcFoot) convertView.getTag();
			} else {
				convertView = mInflater.inflate(R.layout.buy_jcxhlb_list, null);
				myFoot = new MyJcFoot();
				myFoot.hteam = (TextView) convertView.findViewById(valueViewID[0]);
				myFoot.vteam = (TextView) convertView.findViewById(valueViewID[1]);
				myFoot.sbut = (Button) convertView.findViewById(valueViewID[2]);
				myFoot.pbut = (Button) convertView.findViewById(valueViewID[3]);
				myFoot.fbut = (Button) convertView.findViewById(valueViewID[4]);
				myFoot.buttonClose = (Button) convertView.findViewById(valueViewID[5]);
				myFoot.buttonClose.setVisibility(View.INVISIBLE);
				convertView.setTag(myFoot);
			}

			try {
				myFoot.sbut.setSelected(false);
				myFoot.pbut.setSelected(false);
				myFoot.fbut.setSelected(false);
				HashMap<String, Object> appInfo = mAppList.get(position);
				if (appInfo != null) {
					str_hteam = (String) appInfo.get(keyString[1]);
					str_vteam = (String) appInfo.get(keyString[2]);
					str_sp = (String) appInfo.get(keyString[3]);
					int bid = (Integer) appInfo.get(keyString[4]);
					myFoot.hteam.setText(str_hteam);
					myFoot.vteam.setText(str_vteam);
//					System.out.println(str_hteam + "VS" + str_vteam + "----" + str_sp);
					if (containsAny(str_sp, "3")) {
						myFoot.sbut.setSelected(true);
					}
					if (containsAny(str_sp, "1")) {
						myFoot.pbut.setSelected(true);
					}
					if (containsAny(str_sp, "0")) {
						myFoot.fbut.setSelected(true);
					}
					// myFoot.buttonClose.setBackgroundDrawable(myFoot.buttonClose.getResources().getDrawable(bid));
					// myFoot.buttonClose.setOnClickListener(new
					// jcButtonListener(position, myFoot.buttonClose.getId()));
				}
			} catch (Exception e) {
				// TODO: handle exception
				System.out.println(e.toString());
			}
		} else if (mContext.getClass().equals(Zqrx9xhlbActivity.class)) {

			if (convertView != null) {
				myFoot = (MyJcFoot) convertView.getTag();
			} else {
				convertView = mInflater.inflate(R.layout.buy_jcxhlb_list, null);
				myFoot = new MyJcFoot();
				myFoot.hteam = (TextView) convertView.findViewById(valueViewID[0]);
				myFoot.vteam = (TextView) convertView.findViewById(valueViewID[1]);
				myFoot.sbut = (Button) convertView.findViewById(valueViewID[2]);
				myFoot.pbut = (Button) convertView.findViewById(valueViewID[3]);
				myFoot.fbut = (Button) convertView.findViewById(valueViewID[4]);
				myFoot.buttonClose = (Button) convertView.findViewById(valueViewID[5]);
				myFoot.buttonClose.setVisibility(View.INVISIBLE);
				convertView.setTag(myFoot);
			}

			try {
				myFoot.sbut.setSelected(false);
				myFoot.pbut.setSelected(false);
				myFoot.fbut.setSelected(false);
				HashMap<String, Object> appInfo = mAppList.get(position);
				if (appInfo != null) {
					str_hteam = (String) appInfo.get(keyString[1]);
					str_vteam = (String) appInfo.get(keyString[2]);
					str_sp = (String) appInfo.get(keyString[3]);
					int bid = (Integer) appInfo.get(keyString[4]);
					myFoot.hteam.setText(str_hteam);
					myFoot.vteam.setText(str_vteam);
//					System.out.println(str_hteam + "VS" + str_vteam + "----" + str_sp);
					if (containsAny(str_sp, "3")) {
						myFoot.sbut.setSelected(true);
					}
					if (containsAny(str_sp, "1")) {
						myFoot.pbut.setSelected(true);
					}
					if (containsAny(str_sp, "0")) {
						myFoot.fbut.setSelected(true);
					}
					// myFoot.buttonClose.setBackgroundDrawable(myFoot.buttonClose.getResources().getDrawable(bid));
					// myFoot.buttonClose.setOnClickListener(new
					// jcButtonListener(position, myFoot.buttonClose.getId()));
				}
			} catch (Exception e) {
				// TODO: handle exception
				System.out.println(e.toString());
			}

		}*/
		return convertView;
	}

	class lvButtonListener implements OnClickListener {
		private int position;
		private int btnId;

		lvButtonListener(int pos, int id) {
			position = pos;
			btnId = id;
		}

		@Override
		@SuppressWarnings("all")
		public void onClick(View v) {
			int vid = v.getId();
			if (vid == btnId) {
				removeItem(position);
				if (mContext.getClass().equals(SsqxhlbActivity.class)) {
					((SsqxhlbActivity) mContext).InitBaseAdapter(mAppList);
				}
				if (mContext.getClass().equals(DltxhlbActivity.class)) {
					((DltxhlbActivity) mContext).InitBaseAdapter(mAppList);
				}
				if (mContext.getClass().equals(ElvSelFiveListActivity.class)) {
					((ElvSelFiveListActivity) mContext).initSimpleAdapter(mAppList);
				}
				if (mContext.getClass().equals(Kuai3ListActivity.class)) {
					((Kuai3ListActivity) mContext).initSimpleAdapter(mAppList);
				}
				if (mContext.getClass().equals(ElvYunDJListActivity.class)) {
					((ElvYunDJListActivity) mContext).initSimpleAdapter(mAppList);
				}
				if (mContext.getClass().equals(CQSSCListActivity.class)) {
					((CQSSCListActivity) mContext).initSimpleAdapter(mAppList);
				}
				if (mContext.getClass().equals(Pailie3ListActivity.class)) {
					((Pailie3ListActivity) mContext).initSimpleAdapter(mAppList);
				}
				if (mContext.getClass().equals(Pailie5ListActivity.class)) {
					((Pailie5ListActivity) mContext).initSimpleAdapter(mAppList);
				}
				if (mContext.getClass().equals(Fc3dListActivity.class)) {
					((Fc3dListActivity) mContext).initSimpleAdapter(mAppList);
				}
				if (mContext.getClass().equals(N7xxhlbActivity.class)) {
					((N7xxhlbActivity) mContext).initSimpleAdapter(mAppList);
				}
				if (mContext.getClass().equals(N7lxhlbActivity.class)) {
					((N7lxhlbActivity) mContext).initSimpleAdapter(mAppList);
				}
			}
		}
	}

	class jcButtonListener implements OnClickListener {
		private int position;
		private int btnId;
		private String play_method;

		jcButtonListener(int pos, int id, String pm) {
			position = pos;
			btnId = id;
			play_method = pm;
		}

		@Override
		@SuppressWarnings("all")
		public void onClick(View v) {
			int vid = v.getId();
			Log.d("van", "什么鸟情况");
			if (vid == btnId) {
				if(play_method.equals("BDxhlbActivity")){
					if (mAppList.size() > 1) {
						removeItem(position);
						if (mContext.getClass().equals(JcfootxhlbActivity.class)) {
							((JcfootxhlbActivity) mContext).initBaseAdapter(mAppList);
						} else if (mContext.getClass().equals(BDxhlbActivity.class)) {
							((BDxhlbActivity) mContext).initBaseAdapter(mAppList);
						} else if (mContext.getClass().equals(JcBasketballxhlbActivity.class)) {
							((JcBasketballxhlbActivity) mContext).initBaseAdapter(mAppList);
						}
					} else {
						Toast.makeText(mContext,R.string.select_at_least_one_game, Toast.LENGTH_SHORT).show();
					}
				}else{
					if (mAppList.size() > 2) {
						removeItem(position);
						if (mContext.getClass().equals(JcfootxhlbActivity.class)) {
							((JcfootxhlbActivity) mContext).initBaseAdapter(mAppList);
						} else if (mContext.getClass().equals(BDxhlbActivity.class)) {
							((BDxhlbActivity) mContext).initBaseAdapter(mAppList);
						} else if (mContext.getClass().equals(JcBasketballxhlbActivity.class)) {
							((JcBasketballxhlbActivity) mContext).initBaseAdapter(mAppList);
						}
					} else {
						Toast.makeText(mContext, R.string.select_at_least_two_game, Toast.LENGTH_SHORT).show();
					}
				}
			}
		}
	}

	@Override
	public int getCount() {
		return mAppList.size();
	}

	@Override
	public Object getItem(int position) {
		return mAppList.get(position);
	}

	@Override
	public long getItemId(int position) {
		return position;
	}

	public void removeItem(int position) {
		if (mContext.getClass().equals(JcfootxhlbActivity.class)) {
//			((JcfootxhlbActivity) mContext).initBaseAdapter(mAppList);
			JcfootxhlbActivity.initMoney();
		} else if (mContext.getClass().equals(BDxhlbActivity.class)) {
//			((bdxhlbActivity) mContext).initBaseAdapter(mAppList);
			BDxhlbActivity.initMoney();
		} else if (mContext.getClass().equals(JcBasketballxhlbActivity.class)) {
//			((JcBasketballxhlbActivity) mContext).initBaseAdapter(mAppList);
			JcBasketballxhlbActivity.initMoney();
		}
		//如果用户点击删除操作非常快,可能会有数组下标越界异常
		if(position>=mAppList.size()){
			return;
		}
		mAppList.remove(position);
		this.notifyDataSetChanged();
	}

	public ArrayList<BallDTO> GetSsqList() {
		ArrayList<BallDTO> newlist = new ArrayList<BallDTO>();
		//
		for (int i = 0; i < mAppList.size(); i++) {
			String ball1 = (String) mAppList.get(i).get(keyString[0]);
			String ball2 = (String) mAppList.get(i).get(keyString[1]);
			String money = (String) mAppList.get(i).get(keyString[2]);
			BallDTO ballDTO = new BallDTO();
			ballDTO.setSsq_ball(ball1 + "-" + ball2 + "-" + money);
			newlist.add(ballDTO);
		}
		return newlist;
	}

	public ArrayList<BallDTO> GetDltList() {
		ArrayList<BallDTO> newlist = new ArrayList<BallDTO>();
		//
		for (int i = 0; i < mAppList.size(); i++) {
			String ball1 = (String) mAppList.get(i).get(keyString[0]);
			String ball2 = (String) mAppList.get(i).get(keyString[1]);
			String money = (String) mAppList.get(i).get(keyString[2]);
			BallDTO ballDTO = new BallDTO();
			ballDTO.setDlt_ball(ball1 + "-" + ball2 + "-" + money);
			newlist.add(ballDTO);
		}
		return newlist;
	}

	public ArrayList<BallDTO> GetElvList() {
		ArrayList<BallDTO> newlist = new ArrayList<BallDTO>();
		//
		for (int i = 0; i < mAppList.size(); i++) {
			String ball = (String) mAppList.get(i).get(keyString[0]);
			String money = (String) mAppList.get(i).get(keyString[1]);
			BallDTO ballDTO = new BallDTO();
			ballDTO.setElv_ball(ball + "-" + money);
			newlist.add(ballDTO);
		}
		return newlist;
	}

	public ArrayList<BallDTO> GetPl3List() {
		ArrayList<BallDTO> newlist = new ArrayList<BallDTO>();
		//
		for (int i = 0; i < mAppList.size(); i++) {
			String ball = (String) mAppList.get(i).get(keyString[0]);
			String money = (String) mAppList.get(i).get(keyString[1]);
			BallDTO ballDTO = new BallDTO();
			ballDTO.setPl3_ball(ball + "-" + money);
			newlist.add(ballDTO);
		}
		return newlist;
	}

	public ArrayList<ChildDTO> GetFootList() {
		ArrayList<ChildDTO> newlist = new ArrayList<ChildDTO>();
		for (int i = 0; i < mAppList.size(); i++) {
			String mId = (String) mAppList.get(i).get(keyString[0]);
			String str_hteam = (String) mAppList.get(i).get(keyString[1]);
			String str_vteam = (String) mAppList.get(i).get(keyString[2]);
			String str_sp = (String) mAppList.get(i).get(keyString[3]);
			String str_time = (String) mAppList.get(i).get("tip_time");
			ChildDTO childdto = new ChildDTO();
			childdto.mId = mId;
			childdto.hTeam = str_hteam;
			childdto.vTeam = str_vteam;
			childdto.str_sp = str_sp;
			childdto.eTime = str_time;
			newlist.add(childdto);
		}
		return newlist;
	}

	// 判断字符串是否有特点的字符
	static boolean containsAny(String str, String searchChars) {
		return str.contains(searchChars);
	}
}